import { createStore, applyMiddleware } from 'redux';
import thunk from 'redux-thunk';
import {createLogger} from 'redux-logger';
import rootReducer from './reducers';
import { composeWithDevTools } from 'redux-devtools-extension';
const logger = createLogger({ collapsed: true });
export default (()=>{
    const store = createStore(rootReducer,composeWithDevTools(applyMiddleware(
        thunk,
        logger
    )));
    if (module.hot) {
        module.hot.accept('./reducers', () => {
            const nextRootReducer = require('./reducers');
            store.replaceReducer(nextRootReducer);
        });
    }
    return store;
})();
